package org.jeeasy.common.core.handler;

import lombok.RequiredArgsConstructor;
import org.dromara.mpe.annotation.handler.AutoFillHandler;
import org.jeeasy.common.core.service.CurrentAuthUserService;
import org.springframework.stereotype.Component;

import java.lang.reflect.Field;

@Component
@RequiredArgsConstructor
public class SysOrgCodeAutoFillHandler implements AutoFillHandler<String> {
    private final CurrentAuthUserService currentAuthUserService;

    @Override
    public String getVal(Object object, Class<?> clazz, Field field) {
        return currentAuthUserService.getCurrentAuthUser().deptCode();
    }
}
